import logging

from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to

from cpswarehouse.lib.base import BaseController, render

from cpswarehouse.lib.starquery import CpsStarQuery as StarQuery

log = logging.getLogger(__name__)

    from pylons.decorators.cache import beaker_cache

class RacialController(BaseController):
    
    @beaker_cache
    def index(self):
        starquery = StarQuery()
        years = starquery.select_race(func=func.sum).\
            select_year().\
            select_school().\
            group_by_year().\
            fetch_all()

        c.years = years

        

        return render('/racial/index.mako')
